package com.sanyang.lawyer.service.Audit;

import com.sanyang.lawyer.ResultApi.ResponseResult;
import com.sanyang.lawyer.entity.Audit;
import com.sanyang.lawyer.entity.Audit_type;
import com.sanyang.lawyer.entity.Case_audit;
import com.sanyang.lawyer.mapper.audit.Audit_sealMapper;
import org.apache.ibatis.annotations.Update;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

@Service
public class Audit_sealService {
    
    @Autowired
    private Audit_sealMapper sealMapper;

    //添加审核表数据
    public void insertInAudit(Case_audit case_audit){
        Audit audit = case_audit.getAuditid();
        
        Audit_type type = new Audit_type();//写死 3 代表用印申请
        type.setTypeid(3);
        audit.setTypeid(type);  
        
        audit.setSubmitTime(new Date());
        audit.setState("未审核");
        sealMapper.insertInAudit(audit);
    }

    //添加中间表数据
    public void insertInCase_Audit(Case_audit case_audit){
        sealMapper.insertInCase_Audit(case_audit);
    }


    //根据流程id查询出用印审核相关的内容
    public Case_audit querySealByprocessid(String processid){
        return sealMapper.querySealByprocessid(processid);
    }

    //完成审核修改数据
    public void complateUpdate(Audit audit){
        audit.setAuditTime(new Date());
        sealMapper.complateUpdate(audit);
    }
    
}
